Repository navigation
CI: gem variant apply tests assert JSON codes (#1089) - #1642
Conversation
Assisted-by: Claude Code:claude-opus-5-5
The gem variant mismatch tests matched English sentences on human stderr, so a wording change could fail a test whose behaviour was still right. They now check the --json envelope (exit code, status, event actions and errorCodes) and the bytes on disk. The human wording checks move to apply_render.rs, which reuses the policy file's fixtures. The wrong-platform fixture is now a function so both files can share it. Refs #1089 Assisted-by: Claude Code:claude-opus-5-5
Move the gem variant fixtures into apply_fixture.rs, the shared fixture module for the apply suite, instead of having apply_render.rs import a sibling test file. They now reuse its gem installer and manifest writers. The JSON tests also check that a no-matching-variant miss reports no failed event, that the --strict refusal names the mismatched file, and the --force envelope. The render test checks the purl on the warning line itself, and the two no-matching-variant cases are now separate tests. Refs #1089 Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit a641164. Configure here.
|
Labeled Ready for review (burn-down agent).
Generated by Claude Code |
Final review briefWhat it does. The six gem release-variant mismatch tests in Risk: low. Only test files change; no Look here
Verified
Changes I made: none. Open questions (non-blocking)
Auto-merge (squash) is armed, so approving sends this straight to the merge queue. Generated by Claude Code |
|
[agent] Dequeued by merge-queue run 39835618551. The only failed job, Generated by Claude Code |
LLM Description written by Claude Code:claude-opus-5-5
Refs #1089 (the
applygem-variant slice of child 6; the tracking issue stays open)Root cause
apply/cli_gem_variant_mismatch_policy.rschecked gem release-variantbehaviour by matching 8 English sentences on human stderr. A wording
change could fail a test whose behaviour was still right. The rest of
the
applysuite already asserts--jsoncodes in its behaviourtests and keeps the wording in
apply_render.rs.Change
cli_gem_variant_mismatch_policy.rs: all 6 tests now run with--jsonand assert the exit code,status, event actions anderrorCodes, plus the bytes on disk:appliedplus acontent_mismatch_overwrittenevent for the purl.
--strict:failed/apply_failedfor the purl, naming thefile, and no overwrite event.
--force:appliedplus the overwrite event. Before this, onlythe exit code and bytes were checked.
no variant matches:
partialFailurewith noapplied,failedor overwrite event, and the file untouched.
applied, withno overwrite event.
apply_render.rs: 5 new render tests hold the human wording:the mismatch warning line (checked for the purl on that line), the
--stricthash refusal, "no matching variant found" for each of thetwo no-match cases, and no overwrite warning for a skipped sibling.
apply_fixture.rs: now holds the gem variant fixtures(
run_gem_applywithBUNDLE_*scrubbed, and the singleton,wrong-platform and multi-variant fixtures). They reuse its existing
install_gem,patch_record,write_manifestandstage_blob,which drops the policy file's private copies.
Assertions of 4+-word sentences in
cli_gem_variant_mismatch_policy.rswent from 8 to 0. No production code changes.
Testing
cargo test -p socket-patch-cli --all-features --test apply: 153passed, 0 failed, 1 ignored. Main has 148: the 6 policy tests stay,
and 5 render tests were added.
cargo fmt --all -- --check: clean.cargo clippy -p socket-patch-cli --all-features --test apply -- -D warningsreports nothing in the three changed files. Its other findings are
already on main, in
tests/common. CI's clippy command doesn't buildtests, so it's unaffected.
--jsonon main's binary.cfg(windows)/cfg(unix)code changed, so I didn't dispatch afull-scope run.
CI cost
Test-only change in an existing test binary. A lean PR run is the same
before and after: about 28 Linux jobs, about 8 minutes.
/code-review highfindingsapply_fixture.rsinstead of beingimported from a sibling test file. The no-match tests now check for no
failedevent. The--strictevent must name the file.--forcenow checks the envelope. The render purl check is on the warning line
itself. The two no-match render cases are now separate tests. No
constants are exported without a user.
--json, a base with no matching release variant exits 1 withstatus: partialFailureandsummary.failed: 0. Its variants showonly as
skipped/package_not_installed, and no event names thebase or a
no_matching_variantcode (commands/apply.rsaroundlines 2466-2479 and 3040). A JSON consumer can't tell which package
is still unpatched. The tests pin today's shape, so a fix that adds a
failedevent will update them deliberately.Generated by Claude Code